home *** CD-ROM | disk | FTP | other *** search
/ Kit PC World De Ampliacion De Windows 95 / Kit PC World de ampliacion de Windows 95.iso / clarion / cw15 / examp15.z / GRAPHVBX.CLW < prev    next >
Text File  |  1995-09-05  |  28KB  |  877 lines

  1. ! VBX Custom Control Demonstration Program
  2. ! Requires GRAPH.VBX and GSW.EXE supplied with Visual Basic (from Microsoft)
  3.  
  4. ! NB This program is not written with style in mind, as it is
  5. ! purely intended as a demonstration OF some OF the capabilities
  6. ! OF the CW system, and not as a teaching example.
  7.  
  8. TestGraph       PROGRAM
  9.  
  10.         INCLUDE('Equates.CLW')
  11.  
  12.         MAP
  13.           Initialise
  14.           PieGraph
  15.           BarGraph
  16.           GanttGraph
  17.           OtherGraphs
  18.         END
  19.  
  20. ColorQueue      QUEUE,PRE(COL)
  21. ColorName         STRING(13)
  22.                 END
  23.  
  24. FNameQueue      QUEUE,PRE(FNM)
  25. FontName          STRING(6)
  26.                 END
  27.  
  28. GPieStyleQueue  QUEUE,PRE(STY)
  29. PieStyleString    STRING(35)
  30.                 END
  31.  
  32. GBarStyleQueue  QUEUE,PRE(STY)
  33. BarStyleString    STRING(30)
  34.                 END
  35.  
  36. GGanttStyleQueue QUEUE,PRE(STY)
  37. GanttStyleString   STRING(13)
  38.                  END
  39.  
  40. MainWin APPLICATION('VBX Custom Control Test'),AT(31,8,240,101),ICON('WINPYR.ICO'),HLP('About'),STATUS, |
  41.          SYSTEM
  42.        MENUBAR
  43.          MENU('&File'),HLP('FILE_MENU'),MSG('File menu')
  44.            ITEM('&Pie Charts'),USE(?PieGraph),MSG('Demonstrate Pie Charts')
  45.            ITEM('&Bar Graphs'),USE(?BarGraph),MSG('Demonstrate Bar Charts')
  46.            ITEM('&Gantt Charts'),USE(?GanttGraph),MSG('Demonstrate Gantt Charts')
  47.            ITEM('&Other Types'),USE(?FileOtherTypes)
  48.            ITEM,SEPARATOR
  49.            ITEM('E&xit'),USE(?MainExit),MSG('Quit Graph VBX Testing')
  50.          END
  51.          MENU('&Help'),USE(?Help)
  52.            ITEM('&Contents'),USE(?Contents)
  53.          END
  54.        END
  55.      END
  56.  
  57.  
  58.   CODE
  59.   HELP('Graph.hlp')
  60.   Initialise
  61.   
  62.   OPEN(MainWin)
  63.   ACCEPT
  64.  
  65.     CASE EVENT()
  66.     OF Event:ACCEPTED
  67.       CASE ACCEPTED()
  68.       OF ?PieGraph
  69.         PieGraph()
  70.       OF ?BarGraph
  71.         BarGraph()
  72.       OF ?GanttGraph
  73.         GanttGraph()
  74.       OF ?FileOtherTypes
  75.         OtherGraphs
  76.       OF ?Contents
  77.         HELP
  78.       OF ?MainExit
  79.         BREAK
  80.   . . .
  81.  
  82.   CLOSE(MainWin)
  83.   FREE(ColorQueue)
  84.   FREE(FNameQueue)
  85.   FREE(GPieStyleQueue)
  86.   FREE(GBarStyleQueue)
  87.   FREE(GGanttStyleQueue)
  88.  
  89. Initialise      PROCEDURE
  90.  
  91. ColorString     STRING(208)
  92. Color           STRING(13),Dim(16),Over(ColorString)
  93.  
  94.   CODE
  95.  
  96.   ColorString = 'Black        Blue         Green        Cyan         '& |
  97.                 'Red          Magenta      Brown        Light Gray   '& |
  98.                 'Dark Gray    Light Blue   Light Green  Light Cyan   '& |
  99.                 'Light Red    Light MagentaYellow       White        '
  100.  
  101.   LOOP zx# = 1 TO 16
  102.     COL:ColorName = COLOR[zx#]
  103.     ADD(ColorQueue)
  104.   END
  105.  
  106.   FNM:FontName = 'Roman';  ADD(FNameQueue)
  107.   FNM:FontName = 'Swiss';  ADD(FNameQueue)
  108.   FNM:FontName = 'Modern'; ADD(FNameQueue)
  109.  
  110.   STY:PieStyleString = 'Default'; ADD(GPieStyleQueue)
  111.   STY:PieStyleString = 'No label lines'; ADD(GPieStyleQueue)
  112.   STY:PieStyleString = 'Colored labels'; ADD(GPieStyleQueue)
  113.   STY:PieStyleString = 'Colored labels without lines'; ADD(GPieStyleQueue)
  114.   STY:PieStyleString = '% Labels'; ADD(GPieStyleQueue)
  115.   STY:PieStyleString = '% Labels without lines'; ADD(GPieStyleQueue)
  116.   STY:PieStyleString = '% Colored labels'; ADD(GPieStyleQueue)
  117.   STY:PieStyleString = '% Colored labels without lines'; ADD(GPieStyleQueue)
  118.  
  119.   STY:BarStyleString = 'Default'; ADD(GBarStyleQueue)
  120.   STY:BarStyleString = 'Horizontal'; ADD(GBarStyleQueue)
  121.   STY:BarStyleString = 'Stacked'; ADD(GBarStyleQueue)
  122.   STY:BarStyleString = 'Horizontal stacked'; ADD(GBarStyleQueue)
  123.   STY:BarStyleString = 'Stacked %'; ADD(GBarStyleQueue)
  124.   STY:BarStyleString = 'Horizontal stacked %'; ADD(GBarStyleQueue)
  125.   STY:BarStyleString = 'Z-clustered (3D)'; ADD(GBarStyleQueue)
  126.   STY:BarStyleString = 'Horizontal Z-clustered (3D)'; ADD(GBarStyleQueue)
  127.  
  128.   STY:GanttStyleString = 'Default'; ADD(GGanttStyleQueue)
  129.   STY:GanttStyleString = 'Spaced bars'; ADD(GGanttStyleQueue)
  130.  
  131. PieGraph        PROCEDURE
  132.  
  133. Title           STRING(50)
  134. BackColor       STRING(13)
  135. GraphType       STRING(7)
  136. LeftTitle       STRING(80)
  137. BottomTitle     STRING(80)
  138. FontSize        SHORT
  139. FontFamily      BYTE
  140. Italic          BYTE
  141. Bold            BYTE
  142. Underline       BYTE
  143. Palette         STRING(15)
  144. PieType         STRING(7)
  145. GraphStyle      STRING(35)
  146. Exploded        BYTE
  147. Legend          BYTE
  148. NumPoints       SHORT
  149. PointNum        SHORT
  150. Color           STRING(13)
  151. Pattern         SHORT
  152. ExplPoint       BYTE
  153. LabelText       STRING(20)
  154. LegendText      STRING(20)
  155. GStyle          SHORT
  156. ColorNum        SHORT
  157. Value           SHORT
  158. Ret             BYTE
  159.  
  160.  
  161. PieScreen WINDOW('Pie Charts Demonstration'),AT(,,315,215),STATUS,SYSTEM,GRAY,DOUBLE
  162.        CUSTOM('Graph'),AT(150,30,150,130),USE(?Graph),CLASS('Graph.VBX','Graph'),'MousePointer'('3')
  163.        STRING('Font Style:'),AT(7,49),USE(?String2),TRN
  164.        STRING('Y-Axis Title:'),AT(87,69),USE(?String6),TRN
  165.        BUTTON('E&xit'),AT(260,196,30,15),USE(?Exit)
  166.        BUTTON('&Refresh Graph'),AT(193,196,57,15),USE(?Display)
  167.        LIST,AT(7,31,74,10),FONT('Arial',8,,),MSG('Select Background Colour'),USE(BackColor),FORMAT('80L'), |
  168.            DROP(16),FROM(ColorQueue)
  169.        LIST,AT(6,61,74,10),FONT('Arial',8,,),MSG('Select Font Family'),USE(FontFamily),FORMAT('80L'), |
  170.            DROP(3),FROM(FNameQueue)
  171.        STRING('Graph Style:'),AT(7,84),USE(?String3),TRN
  172.        LIST,AT(7,93,74,10),FONT('Arial',8,,),MSG('Select Graph Style'),USE(GraphStyle),FORMAT('80L'), |
  173.            DROP(8),FROM(GPieStyleQueue)
  174.        ENTRY(@n3),AT(97,27,29,12),MSG('Enter Font Size'),USE(FontSize),LEFT,OVR
  175.        ENTRY(@s80),AT(97,53,29,12),MSG('Enter X-Axis title'),USE(BottomTitle),LEFT,OVR
  176.        ENTRY(@s80),AT(97,80,29,12),MSG('Enter Y-Axis title'),USE(LeftTitle),LEFT,OVR
  177.        ENTRY(@S50),AT(150,8,150,12),FONT('Modern',12,,),USE(Title),SKIP,DISABLE,CENTER,INS
  178.        STRING('Background:'),AT(6,21),USE(?String1),TRN
  179.        STRING('X-Axis Title:'),AT(88,42),USE(?String5),TRN
  180.        OPTION('Coloring'),AT(8,154,60,55),USE(Palette),BOXED
  181.          RADIO('Solid color'),AT(15,166,51,10),USE(?Solid),RIGHT
  182.          RADIO('Pastel'),AT(15,177,48,10),USE(?Pastel),RIGHT
  183.          RADIO('Grayscale'),AT(15,188,49,10),USE(?GrayScale),RIGHT
  184.        END
  185.        GROUP('Text Style'),AT(74,153,60,55),BOXED
  186.          CHECK('Italics'),AT(81,165,33,10),USE(Italic),RIGHT
  187.          CHECK('Bold'),AT(81,178,26,10),USE(Bold),RIGHT
  188.          CHECK('Underline'),AT(81,190,44,10),USE(Underline),RIGHT
  189.        END
  190.        OPTION,AT(6,1,75,19),MSG('Select Pie Type'),USE(PieType),BOXED
  191.          RADIO('2D Pie'),AT(8,7,31,10),USE(?2DPie),RIGHT
  192.          RADIO('3D Pie'),AT(46,7,31,10),USE(?3DPie),RIGHT
  193.        END
  194.        STRING('Font Size:'),AT(93,17),USE(?String4),TRN
  195.        GROUP('Pie Style'),AT(8,111,60,33),BOXED
  196.          CHECK('Exploded'),AT(15,120,43,10),USE(Exploded),RIGHT
  197.          CHECK('Legend'),AT(15,132,41,10),USE(Legend),RIGHT
  198.        END
  199.        GROUP('No. OF Points'),AT(74,111,60,33),BOXED
  200.          ENTRY(@n20),AT(80,125,49,12),USE(NumPoints),RIGHT,OVR
  201.        END
  202.        BUTTON('Specify Points'),AT(90,95,52,15),USE(?SpecPoints)
  203.      END
  204.  
  205. SpecPoint WINDOW('Specify Point Properties'),AT(93,39,130,129),CENTER,GRAY,DOUBLE
  206.        STRING('Point No :'),AT(18,6,32,10),LEFT
  207.        ENTRY(@n3),AT(65,5,19,11),USE(PointNum),DISABLE,RIGHT,INS
  208.        STRING('Color :'),AT(29,23,21,10),LEFT
  209.        LIST,AT(59,22,60,10),FONT('Arial',8,,),MSG('Select Color'),USE(Color),FORMAT('80L'),DROP(16),FROM(ColorQueue)
  210.        STRING('Legend Text :'),AT(6,36,44,10),LEFT
  211.        ENTRY(@s20),AT(59,35,60,10),USE(LegendText),LEFT
  212.        STRING('Label Text :'),AT(12,50,38,10),LEFT
  213.        ENTRY(@s20),AT(59,49,60,10),USE(LabelText),LEFT
  214.        STRING('Pattern :'),AT(23,63,28,10),LEFT
  215.        ENTRY(@n3),AT(59,62,60,10),USE(Pattern),RIGHT,INS
  216.        STRING('Value :'),AT(28,77,22,10),LEFT
  217.        ENTRY(@n5),AT(59,75,60,10),USE(Value),RIGHT,OVR
  218.        CHECK('Exploded  '),AT(24,90,43,10),USE(ExplPoint),LEFT
  219.        BUTTON('Cancel'),AT(25,105,34,14),USE(?Cancel)
  220.        BUTTON('OK'),AT(69,105,34,14),USE(?OKButton),DEFAULT
  221.      END
  222.  
  223.  
  224.  
  225.   CODE
  226.  
  227.   BackColor = 'Light Gray'
  228.   BottomTitle = 'X-Axis'
  229.   LeftTitle = 'Y'
  230.   FontFamily = 'Roman'; FontSize = 100;
  231.   Italic = 0; Bold = 0; Underline = 0
  232.   Palette = 'Solid color'
  233.   PieType = '2D Pie'
  234.   GraphStyle = 'Default'
  235.  
  236.   OPEN(PieScreen)
  237.  
  238.   Title = ?Graph{'CtlVersion'}
  239.   ?Graph{ 'LeftTitle' } = LeftTitle
  240.   ?Graph{ 'BottomTitle' } = BottomTitle
  241.   ?Graph{ 'FontUse' } = 4
  242.   ?Graph{ 'Background' } = 7
  243.   ?Graph{ 'GraphType' } = 1
  244.   NumPoints = ?Graph{'NumPoints'}
  245.   DO ShowGraph                     !for 32-bit compatibility
  246.   ACCEPT
  247.  
  248.     CASE EVENT()
  249.     OF Event:ACCEPTED
  250.       CASE FIELD()
  251.       OF ?BackColor
  252.          ?Graph{ 'Background' } =  Choice()-1
  253.  
  254.       OF ?FontFamily
  255.          ?Graph{ 'FontFamily' } =  Choice()-1
  256.  
  257.       OF ?GraphStyle
  258.          ?Graph{ 'GraphStyle' } =  Choice()-1
  259.  
  260.       OF ?FontSize
  261.          ?Graph{ 'FontSize' } =  FontSize
  262.  
  263.       OF ?BottomTitle
  264.          ?Graph{ 'BottomTitle' } =  BottomTitle
  265.  
  266.       OF ?LeftTitle
  267.          ?Graph{ 'LeftTitle' } =  LeftTitle
  268.  
  269.       OF ?PieType
  270.          EXECUTE CHOICE()
  271.              ?Graph { 'GraphType' } =  1
  272.              ?Graph { 'GraphType' } =  2
  273.          END
  274.       OF ?Palette
  275.          EXECUTE CHOICE()
  276.              ?Graph { 'Palette' } =  0
  277.              ?Graph { 'Palette' } =  1
  278.              ?Graph { 'Palette' } =  2
  279.          END
  280.  
  281.       OF ?Italic orof ?Bold orof ?Underline
  282.          ?Graph { 'FontStyle' } =  BXor(?Graph{ 'FontStyle'}, 2^(Field()-?Italic))
  283.  
  284.  
  285.       OF ?NumPoints
  286.          ?Graph { 'NumPoints' } =  NumPoints
  287.  
  288.       OF ?SpecPoints
  289.          ?Graph { 'AutoInc' } =  0
  290.          GStyle = ?Graph{ 'GraphStyle'}
  291.          LOOP PointNum=1 TO NumPoints
  292.             ?Graph { 'ThisPoint' } =  PointNum
  293.             ColorNum = ?Graph{ 'ColorData'}
  294.             GET(ColorQueue, ColorNum+1)
  295.             Color = COL:ColorName
  296.             Value = ?Graph{ 'GraphData'}
  297.             Pattern = ?Graph{ 'PatternData'}
  298.             LabelText = ?Graph{ 'LabelText'}
  299.             ExplPoint = ?Graph{ 'ExtraData'}
  300.             LegendText = ?Graph{ 'LegendText'}
  301.             DO SpecifyPoint
  302.             IF Ret
  303.               ?Graph { 'GraphData' } =  Value
  304.               ?Graph { 'PatternData' } =  Pattern
  305.               ?Graph { 'ColorData' } =  ColorNum
  306.               ?Graph { 'LabelText' } =  LabelText
  307.               ?Graph { 'ExtraData' } =  ExplPoint
  308.               ?Graph { 'LegendText' } =  LegendText
  309.             END
  310.          END
  311.  
  312.       OF ?Display
  313.          Do ShowGraph
  314.  
  315.       OF ?Exit
  316.          BREAK
  317.   . . .
  318.  
  319.   Close(PieScreen)
  320.  
  321.  
  322. SpecifyPoint   ROUTINE
  323.  
  324.         OPEN(SpecPoint)
  325.         IF NOT Legend
  326.            DISABLE(?LegendText)
  327.         ELSE
  328.            ENABLE(?LegendText)
  329.         END
  330.         IF NOT Exploded
  331.            DISABLE(?ExplPoint)
  332.         ELSE
  333.            ENABLE(?ExplPoint)
  334.         END
  335.         IF GStyle < 1 OR GStyle > 3
  336.            DISABLE(?LabelText)
  337.         ELSE
  338.            ENABLE(?LabelText)
  339.         END
  340.         DISPLAY
  341.         ACCEPT
  342.            CASE Accepted()
  343.            OF ?Color
  344.               ColorNum = Choice()-1
  345.  
  346.            OF ?OKButton
  347.               Ret = 1
  348.               BREAK
  349.  
  350.            OF ?Cancel
  351.               Ret = 0
  352.               BREAK
  353.            END
  354.         END
  355.         CLOSE(SpecPoint)
  356.  
  357.  
  358. ShowGraph     ROUTINE
  359.  
  360.   ?Graph { 'DrawMode' } =  2
  361.  
  362.  
  363.  
  364. BarGraph        PROCEDURE
  365.  
  366. Title           STRING(50)
  367. BackColor       STRING(13)
  368. GraphType       STRING(7)
  369. LeftTitle       STRING(80)
  370. BottomTitle     STRING(80)
  371. FontSize        SHORT
  372. FontFamily      BYTE
  373. Italic          BYTE
  374. Bold            BYTE
  375. Underline       BYTE
  376. Palette         STRING(15)
  377. BarType         STRING(7)
  378. GraphStyle      STRING(35)
  379. Legend          BYTE
  380. Labels          BYTE
  381. NumPoints       SHORT
  382. NumSets         SHORT
  383. PointNum        SHORT
  384. SetNum          SHORT
  385. ForeColor       STRING(13)
  386. SideColor       STRING(13)
  387. Pattern         SHORT
  388. LabelText       STRING(20)
  389. LegendText      STRING(20)
  390. GStyle          SHORT
  391. ForeColorNum    SHORT
  392. SideColorNum    SHORT
  393. Value           SHORT
  394. Ret             BYTE
  395. PointSet        STRING(10)
  396. Choice          SHORT
  397.  
  398. BarScreen WINDOW('Bar Charts Demonstration'),AT(,,315,215),STATUS,SYSTEM,GRAY,DOUBLE
  399.        CUSTOM('Graph'),AT(150,30,150,130),USE(?Graph),CLASS('Graph.VBX','Graph')
  400.        BUTTON('E&xit'),AT(260,196,30,15),USE(?Exit)
  401.        BUTTON('&Refresh Display'),AT(191,196,60,15),USE(?Display)
  402.        LIST,AT(6,36,74,10),FONT('Arial',8,,),MSG('Select Background Colour'),USE(BackColor),FORMAT('80L'), |
  403.            DROP(16),FROM(ColorQueue)
  404.        STRING('X-Axis Title:'),AT(104,36),USE(?String4),TRN
  405.        LIST,AT(6,59,74,10),FONT('Arial',8,,),MSG('Select Font Family'),USE(FontFamily),FORMAT('80L'), |
  406.            DROP(3),FROM(FNameQueue)
  407.        STRING('Y-Axis Title:'),AT(104,64),USE(?String5),TRN
  408.        STRING('Graph Style:'),AT(7,71),USE(?String8),TRN
  409.        LIST,AT(7,82,74,10),FONT('Arial',8,,),MSG('Select Graph Style'),USE(GraphStyle),FORMAT('80L'), |
  410.            DROP(8),FROM(GBarStyleQueue)
  411.        ENTRY(@n3),AT(104,18,29,12),MSG('Enter Font Size'),USE(FontSize),LEFT,OVR
  412.        STRING('Background Color:'),AT(6,25),USE(?String6),TRN
  413.        ENTRY(@s80),AT(104,47,29,12),MSG('Enter X-Axis title'),USE(BottomTitle),LEFT,OVR
  414.        STRING('Font Type:'),AT(6,48),USE(?String7),TRN
  415.        ENTRY(@s80),AT(104,76,29,12),MSG('Enter Y-Axis title'),USE(LeftTitle),LEFT,OVR
  416.        ENTRY(@S50),AT(150,8,150,12),FONT('Modern',12,,),USE(Title),SKIP,DISABLE,CENTER,INS
  417.        OPTION('Coloring'),AT(8,156,60,55),USE(Palette),BOXED
  418.          RADIO('Solid color'),AT(15,168,51,10),USE(?Solid),RIGHT
  419.          RADIO('Pastel'),AT(15,179,48,10),USE(?Pastel),RIGHT
  420.          RADIO('Grayscale'),AT(15,190,49,10),USE(?GrayScale),RIGHT
  421.        END
  422.        GROUP('Text Style'),AT(74,156,60,55),BOXED
  423.          CHECK('Italics'),AT(81,167,33,10),USE(Italic),RIGHT
  424.          CHECK('Bold'),AT(81,180,26,10),USE(Bold),RIGHT
  425.          CHECK('Underline'),AT(81,192,44,10),USE(Underline),RIGHT
  426.        END
  427.        OPTION,AT(6,4,75,19),MSG('Select Bar Type'),USE(BarType),BOXED
  428.          RADIO('2D Bar'),AT(8,11,31,10),USE(?2DBar),RIGHT
  429.          RADIO('3D Bar'),AT(44,11,31,10),USE(?3DBar),RIGHT
  430.        END
  431.        STRING('Font Size:'),AT(104,6),USE(?String3),TRN
  432.        GROUP('Bar Style'),AT(8,113,60,39),BOXED
  433.          CHECK('Legend'),AT(15,136,41,10),TIP('Enables Legend entry in Specify Points option'),USE(Legend), |
  434.              RIGHT
  435.          CHECK('Labels'),AT(15,125,34,10),TIP('Enables Label entry in Specify Points option'),USE(Labels), |
  436.              RIGHT
  437.        END
  438.        GROUP('No OF'),AT(74,113,60,39),BOXED
  439.          ENTRY(@n20),AT(109,124,20,10),USE(NumPoints),RIGHT,OVR
  440.          ENTRY(@n20),AT(109,137,20,10),USE(NumSets),RIGHT,OVR
  441.          STRING('Points :'),AT(80,126,25,10),LEFT
  442.          STRING('Sets :'),AT(80,136,19,10),LEFT
  443.        END
  444.        BUTTON('Specify Points'),AT(84,96,53,14),USE(?SpecPoints)
  445.      END
  446.  
  447.  
  448.  
  449. SpecPoint WINDOW('Specify Point Properties'),AT(93,39,130,129),CENTER,GRAY,DOUBLE
  450.        STRING('Point / Set No :'),AT(4,7,48,10),RIGHT
  451.        ENTRY(@s10),AT(62,5,31,11),USE(PointSet),SKIP,RIGHT,INS
  452.        STRING('Front Color :'),AT(8,21,45,10),RIGHT
  453.        LIST,AT(62,19,60,10),FONT('Arial',8,,),MSG('Select Color'),USE(ForeColor),FORMAT('80L'),DROP(16), |
  454.            FROM(ColorQueue)
  455.        STRING('Side Color :'),AT(14,35,38,10),RIGHT
  456.        LIST,AT(62,33,60,10),FONT('Arial',8,,),MSG('Select Color'),USE(SideColor),FORMAT('80L'),DROP(16), |
  457.            FROM(ColorQueue)
  458.        STRING('Legend Text :'),AT(8,49,44,10),RIGHT
  459.        ENTRY(@s20),AT(62,47,60,10),USE(LegendText),LEFT,INS
  460.        STRING('Label Text :'),AT(14,63,38,10),RIGHT
  461.        ENTRY(@s20),AT(62,61,60,10),USE(LabelText),LEFT,INS
  462.        STRING('Pattern :'),AT(24,77,28,10),RIGHT
  463.        ENTRY(@n3),AT(62,75,60,10),USE(Pattern),RIGHT,INS
  464.        STRING('Value :'),AT(30,93,22,10),RIGHT
  465.        ENTRY(@n5),AT(62,91,60,10),USE(Value),RIGHT,OVR
  466.        BUTTON('Cancel'),AT(25,105,34,14),USE(?Cancel)
  467.        BUTTON('OK'),AT(69,105,34,14),USE(?OKButton),DEFAULT
  468.      END
  469.  
  470.  
  471.  
  472.   CODE
  473.  
  474.   BackColor = 'Light Gray'
  475.   BottomTitle = 'X-Axis'
  476.   LeftTitle = 'Y'
  477.   FontFamily = 'Roman'; FontSize = 100;
  478.   Italic = 0; Bold = 0; Underline = 0
  479.   Palette = 'Solid color'
  480.   BarType = '2D Bar'
  481.   GraphStyle = 'Default'
  482.  
  483.   OPEN(BarScreen)
  484.  
  485.   Title = ?Graph{ 'CtlVersion'}
  486.   ?Graph { 'LeftTitle' } =  LeftTitle
  487.   ?Graph { 'BottomTitle' } =  BottomTitle
  488.   ?Graph { 'FontUse' } =  4
  489.   ?Graph { 'Background' } =  7
  490.   ?Graph { 'GraphType' } =  3
  491.   NumPoints = ?Graph{ 'NumPoints'}
  492.   NumSets = ?Graph{ 'NumSets'}
  493.   DO ShowGraph
  494.   ACCEPT
  495.  
  496.     CASE EVENT()
  497.     OF Event:ACCEPTED
  498.       CASE FIELD()
  499.       OF ?BackColor
  500.          ?Graph { 'Background' } =  CHOICE()-1
  501.  
  502.       OF ?FontFamily
  503.          ?Graph { 'FontFamily' } =  CHOICE()-1
  504.  
  505.       OF ?GraphStyle
  506.          Choice = CHOICE()-1
  507.          ?Graph { 'GraphStyle' } =  Choice
  508.          IF Choice >= 6
  509.             BarType = '3D Bar'
  510.             ?Graph { 'GraphType' } =  4
  511.          END
  512.  
  513.       OF ?FontSize
  514.          ?Graph { 'FontSize' } =  FontSize
  515.  
  516.       OF ?BottomTitle
  517.          ?Graph { 'BottomTitle' } =  BottomTitle
  518.  
  519.       OF ?LeftTitle
  520.          ?Graph { 'LeftTitle' } =  LeftTitle
  521.  
  522.       OF ?Palette
  523.          EXECUTE CHOICE()
  524.              ?Graph { 'Palette' } =  0
  525.              ?Graph { 'Palette' } =  1
  526.              ?Graph { 'Palette' } =  2
  527.          END
  528.  
  529.       OF ?Italic orof ?Bold orof ?Underline
  530.          ?Graph { 'FontStyle' } =  BXor(?Graph{ 'FontStyle'}, 2^(Field()-?Italic))
  531.  
  532.       OF ?BarType
  533.          EXECUTE CHOICE()
  534.              ?Graph { 'GraphType' } =  3
  535.              ?Graph { 'GraphType' } =  4
  536.          END
  537.  
  538.  
  539.       OF ?NumPoints
  540.          ?Graph { 'NumPoints' } =  NumPoints
  541.  
  542.       OF ?NumSets
  543.          ?Graph { 'NumSets' } =  NumSets
  544.  
  545.       OF ?SpecPoints
  546.          ?Graph { 'AutoInc' } =  0
  547.          LOOP SetNum=1 TO NumSets
  548.             ?Graph { 'ThisSet' } =  SetNum
  549.             LOOP PointNum=1 TO NumPoints
  550.                ?Graph { 'ThisPoint' } =  PointNum
  551.                ForeColorNum = ?Graph{ 'ColorData'}
  552.                SideColorNum = ?Graph{ 'ExtraData'}
  553.                GET(ColorQueue, ForeColorNum+1)
  554.                ForeColor = COL:ColorName
  555.                GET(ColorQueue, SideColorNum+1)
  556.                SideColor = COL:ColorName
  557.                Value = ?Graph{ 'GraphData'}
  558.                Pattern = ?Graph{ 'PatternData'}
  559.                LabelText = ?Graph{ 'LabelText'}
  560.                LegendText = ?Graph{ 'LegendText'}
  561.                DO SpecifyPoint
  562.                IF Ret
  563.                  ?Graph { 'GraphData' } =  Value
  564.                  ?Graph { 'PatternData' } =  Pattern
  565.                  ?Graph { 'ColorData' } =  ForeColorNum
  566.                  ?Graph { 'ExtraData' } =  SideColorNum
  567.                  ?Graph { 'LabelText' } =  LabelText
  568.                  ?Graph { 'LegendText' } =  LegendText
  569.                END
  570.             END
  571.          END
  572.  
  573.       OF ?Display
  574.          Do ShowGraph
  575.  
  576.       OF ?Exit
  577.          BREAK
  578.   . . .
  579.  
  580.   CLOSE(BarScreen)
  581.  
  582.  
  583.  
  584. SpecifyPoint   ROUTINE
  585.  
  586.   PointSet = PointNum &' / ' & SetNum
  587.   DISPLAY(?PointSet)
  588.         OPEN(SpecPoint)
  589.         IF NOT Legend
  590.            DISABLE(?LegendText)
  591.         END
  592.         IF NOT Labels
  593.            DISABLE(?LabelText)
  594.         END
  595.         DISPLAY
  596.         ACCEPT
  597.            CASE Accepted()
  598.            OF ?ForeColor
  599.               ForeColorNum = Choice()-1
  600.  
  601.            OF ?SideColor
  602.               SideColorNum = Choice()-1
  603.  
  604.            OF ?OKButton
  605.               Ret = 1
  606.               BREAK
  607.  
  608.            OF ?Cancel
  609.               Ret = 0
  610.               BREAK
  611.            END
  612.         END
  613.         CLOSE(SpecPoint)
  614.  
  615.  
  616.  
  617. ShowGraph     ROUTINE
  618.  
  619.   ?Graph { 'DrawMode' } =  2
  620.  
  621.  
  622.     
  623.  
  624. GanttGraph        PROCEDURE
  625.  
  626. Title           STRING(50)
  627. BackColor       STRING(13)
  628. GraphType       STRING(7)
  629. LeftTitle       STRING(80)
  630. BottomTitle     STRING(80)
  631. FontSize        SHORT
  632. FontFamily      BYTE
  633. Italic          BYTE
  634. Bold            BYTE
  635. Underline       BYTE
  636. Palette         STRING(15)
  637. GraphStyle      STRING(35)
  638. Legend          BYTE
  639. Labels          BYTE
  640. NumPoints       SHORT
  641. NumSets         SHORT
  642. PointNum        SHORT
  643. SetNum          SHORT
  644. ForeColor       STRING(13)
  645. Pattern         SHORT
  646. LabelText       STRING(20)
  647. LegendText      STRING(20)
  648. GStyle          SHORT
  649. ForeColorNum    SHORT
  650. Value           SHORT
  651. Ret             BYTE
  652. PointSet        STRING(10)
  653. Choice          SHORT
  654.  
  655. GanttScreen WINDOW('Gantt Charts Demonstration'),AT(,,315,215),STATUS,SYSTEM,GRAY,DOUBLE
  656.        STRING('Background Color:'),AT(8,6),USE(?String3)
  657.        STRING('Font Size:'),AT(103,7),USE(?String6)
  658.        CUSTOM('Graph'),AT(150,30,150,130),USE(?Graph),CLASS('Graph.VBX','Graph')
  659.        STRING('X-Axis Title:'),AT(104,37),USE(?String7)
  660.        STRING('Font Type:'),AT(7,38),USE(?String4)
  661.        BUTTON('E&xit'),AT(260,196,30,15),USE(?Exit)
  662.        BUTTON('Refresh &Display'),AT(191,196,59,15),USE(?Display)
  663.        LIST,AT(7,18,74,10),FONT('Arial',8,,),MSG('Select Background Colour'),USE(BackColor),FORMAT('80L'), |
  664.            DROP(16),FROM(ColorQueue)
  665.        LIST,AT(7,49,74,10),FONT('Arial',8,,),MSG('Select Font Family'),USE(FontFamily),FORMAT('80L'), |
  666.            DROP(3),FROM(FNameQueue)
  667.        STRING('Y-Axis Title:'),AT(104,67),USE(?String8)
  668.        STRING('Graph Style:'),AT(7,68),USE(?String5)
  669.        LIST,AT(7,80,74,10),FONT('Arial',8,,),MSG('Select Graph Style'),USE(GraphStyle),FORMAT('80L'), |
  670.            DROP(2),FROM(GGanttStyleQueue)
  671.        ENTRY(@n3),AT(103,18,29,12),MSG('Enter Font Size'),USE(FontSize),LEFT,OVR
  672.        ENTRY(@s80),AT(103,48,29,12),MSG('Enter X-Axis title'),USE(BottomTitle),LEFT,OVR
  673.        ENTRY(@s80),AT(103,79,29,12),MSG('Enter Y-Axis title'),USE(LeftTitle),LEFT,OVR
  674.        ENTRY(@S50),AT(150,8,150,12),FONT('Modern',12,,),USE(Title),SKIP,CENTER,INS
  675.        OPTION('Coloring'),AT(7,154,60,55),USE(Palette),BOXED
  676.          RADIO('Solid color'),AT(14,166,51,10),USE(?Solid),RIGHT
  677.          RADIO('Pastel'),AT(14,177,48,10),USE(?Pastel),RIGHT
  678.          RADIO('Grayscale'),AT(14,188,49,10),USE(?GrayScale),RIGHT
  679.        END
  680.        GROUP('Text Style'),AT(73,154,60,55),BOXED
  681.          CHECK('Italics'),AT(80,165,33,10),USE(Italic),RIGHT
  682.          CHECK('Bold'),AT(80,178,26,10),USE(Bold),RIGHT
  683.          CHECK('Underline'),AT(80,190,44,10),USE(Underline),RIGHT
  684.        END
  685.        GROUP('Gantt Style'),AT(7,111,60,39),BOXED
  686.          CHECK('Legend'),AT(14,134,41,10),TIP('Enable Legend entry in Specify Points option'),USE(Legend), |
  687.              RIGHT
  688.          CHECK('Labels'),AT(14,123,34,10),TIP('Enable Labels entry in Specify Points option'),USE(Labels), |
  689.              RIGHT
  690.        END
  691.        GROUP('No OF'),AT(73,111,60,39),BOXED
  692.          ENTRY(@n20),AT(108,122,20,10),USE(NumPoints),RIGHT,OVR
  693.          ENTRY(@n20),AT(108,135,20,10),USE(NumSets),RIGHT,OVR
  694.          STRING('Points :'),AT(79,124,25,10),LEFT
  695.          STRING('Sets :'),AT(79,134,19,10),LEFT
  696.        END
  697.        BUTTON('Specify Points'),AT(86,94,52,15),USE(?SpecPoints)
  698.      END
  699.  
  700. SpecPoint  WINDOW('Specify Point Properties'),AT(93,39,130,129),CENTER,GRAY,DOUBLE
  701.              BUTTON('Cancel'),AT(25,105,34,14),USE(?Cancel)
  702.              BUTTON('OK'),AT(69,105,34,14),USE(?OKButton),DEFAULT
  703.              STRING('Point / Set No :'),AT(4,7,48,10),RIGHT
  704.              ENTRY(@s10),AT(62,5,31,11),USE(PointSet),SKIP,RIGHT,INS
  705.              ENTRY(@n3),AT(62,62,60,10),USE(Pattern),RIGHT,INS
  706.              STRING('Pattern :'),AT(24,64,28,10),RIGHT
  707.              LIST,AT(62,19,60,10),FONT('Arial',8,00H),MSG('Select Color'),USE(ForeColor),FORMAT('80L'),DROP(16),FROM(ColorQueue)
  708.              STRING('Color :'),AT(12,21,38,10),RIGHT
  709.              STRING('Legend Text :'),AT(8,36,44,10),RIGHT
  710.              STRING('Label Text :'),AT(14,50,38,10),RIGHT
  711.              ENTRY(@s20),AT(62,34,60,10),USE(LegendText),LEFT,INS
  712.              ENTRY(@s20),AT(62,48,60,10),USE(LabelText),LEFT,INS
  713.              STRING('Value :'),AT(30,80,22,10),RIGHT
  714.              ENTRY(@n5),AT(62,78,60,10),USE(Value),RIGHT,OVR
  715.            END
  716.  
  717.  
  718.   CODE
  719.  
  720.   BackColor = 'Light Gray'
  721.   BottomTitle = 'X-Axis'
  722.   LeftTitle = 'Y'
  723.   FontFamily = 'Roman'; FontSize = 100;
  724.   Italic = 0; Bold = 0; Underline = 0
  725.   Palette = 'Solid color'
  726.   GraphStyle = 'Default'
  727.  
  728.   OPEN(GanttScreen)
  729.  
  730.   Title = ?Graph{ 'CtlVersion'}
  731.   ?Graph { 'LeftTitle' } =  LeftTitle
  732.   ?Graph { 'BottomTitle' } =  BottomTitle
  733.   ?Graph { 'FontUse' } =  4
  734.   ?Graph { 'Background' } =  7
  735.   ?Graph { 'GraphType' } =  5
  736.   NumPoints = ?Graph{ 'NumPoints'}
  737.   NumSets = ?Graph{ 'NumSets'}
  738.   DO ShowGraph
  739.  
  740.   ACCEPT
  741.  
  742.     CASE EVENT()
  743.     OF Event:ACCEPTED
  744.       CASE FIELD()
  745.       OF ?BackColor
  746.          ?Graph { 'Background' } =  CHOICE()-1
  747.  
  748.       OF ?FontFamily
  749.          ?Graph { 'FontFamily' } =  CHOICE()-1
  750.  
  751.       OF ?GraphStyle
  752.          ?Graph { 'GraphStyle' } =  CHOICE()-1
  753.  
  754.       OF ?FontSize
  755.          ?Graph { 'FontSize' } =  FontSize
  756.  
  757.       OF ?BottomTitle
  758.          ?Graph { 'BottomTitle' } =  BottomTitle
  759.  
  760.       OF ?LeftTitle
  761.          ?Graph { 'LeftTitle' } =  LeftTitle
  762.  
  763.       OF ?Palette
  764.          EXECUTE CHOICE()
  765.              ?Graph { 'Palette' } =  0
  766.              ?Graph { 'Palette' } =  1
  767.              ?Graph { 'Palette' } =  2
  768.          END
  769.  
  770.       OF ?Italic OROF ?Bold OROF ?Underline
  771.          ?Graph { 'FontStyle' } =  BXOR(?Graph{ 'FontStyle'}, 2^(FIELD()-?Italic))
  772.  
  773.       OF ?NumPoints
  774.          ?Graph { 'NumPoints' } =  NumPoints
  775.  
  776.       OF ?NumSets
  777.          ?Graph { 'NumSets' } =  NumSets
  778.  
  779.       OF ?SpecPoints
  780.          ?Graph { 'AutoInc' } =  0
  781.          LOOP SetNum=1 TO NumSets
  782.             ?Graph { 'ThisSet' } =  SetNum
  783.             LOOP PointNum=1 TO NumPoints
  784.                ?Graph { 'ThisPoint' } =  PointNum
  785.                ForeColorNum = ?Graph{ 'ColorData'}
  786.                GET(ColorQueue, ForeColorNum+1)
  787.                ForeColor = COL:ColorName
  788.                Value = ?Graph{ 'GraphData'}
  789.                Pattern = ?Graph{ 'PatternData'}
  790.                LabelText = ?Graph{ 'LabelText'}
  791.                LegendText = ?Graph{ 'LegendText'}
  792.                DO SpecifyPoint
  793.                IF Ret
  794.                  ?Graph { 'GraphData' } =  Value
  795.                  ?Graph { 'PatternData' } =  Pattern
  796.                  ?Graph { 'ColorData' } =  ForeColorNum
  797.                  ?Graph { 'LabelText' } =  LabelText
  798.                  ?Graph { 'LegendText' } =  LegendText
  799.                END
  800.             END
  801.          END
  802.  
  803.       OF ?Display
  804.          DO ShowGraph
  805.  
  806.       OF ?Exit
  807.          BREAK
  808.   . . .
  809.  
  810.   Close(GanttScreen)
  811.  
  812.  
  813. SpecifyPoint   ROUTINE
  814.  
  815.   PointSet = PointNum &' / ' & SetNum
  816.   DISPLAY(?PointSet)
  817.   OPEN(SpecPoint)
  818.   IF NOT Legend
  819.     DISABLE(?LegendText)
  820.   END
  821.   IF NOT Labels
  822.     DISABLE(?LabelText)
  823.   END
  824.   IF SetNum = 1
  825.     DISABLE(?LabelText)
  826.     DISABLE(?LegendText)
  827.   END
  828.   DISPLAY
  829.   ACCEPT
  830.     CASE ACCEPTED()
  831.     OF ?ForeColor
  832.       ForeColorNum = CHOICE()-1
  833.  
  834.     OF ?OKButton
  835.       Ret = 1
  836.       BREAK
  837.  
  838.     OF ?Cancel
  839.       Ret = 0
  840.       BREAK
  841.     END
  842.   END
  843.   CLOSE(SpecPoint)
  844.  
  845.  
  846.  
  847. ShowGraph     ROUTINE
  848.  
  849.   ?Graph { 'DrawMode' } =  2
  850.  
  851.  
  852. OtherGraphs     PROCEDURE
  853.  
  854. window WINDOW('Other Graph Types Available'),AT(,,185,92),CENTER,GRAY
  855.          STRING('The Chart Builder GRAPH.VBX also provides support'),AT(7,7),USE(?String1)
  856.          STRING('for line, Log/Lin, Polar, Area, Scatter, and  High-Low-'),AT(7,21),USE(?String2)
  857.          STRING('Close types.  Please consult the Chart Builder help'),AT(7,35),USE(?String3)
  858.          STRING('for more information.'),AT(7,50),USE(?String4)
  859.          BUTTON('OK'),AT(75,75,35,14),USE(?OkButton),DEFAULT
  860.        END
  861.  
  862.  
  863.     CODE
  864.  
  865.     OPEN(window)
  866.  
  867.     ACCEPT
  868.       CASE EVENT()
  869.       OF Event:Accepted
  870.         CASE FIELD()
  871.         OF ?OkButton
  872.           BREAK
  873.         END
  874.       END
  875.     END
  876.     CLOSE(window)
  877.